<#include "/common/head.ftl">

<@showTitle title="${i18n.getMessage('teacher')} > ${i18n.getMessage('edit')}">
	<a href="#" onclick="cc('teacher/showInfoTeacher.sgt?id=${teacher.id}')">${i18n.getMessage('teacher')}</a>
</@showTitle>

<div id="error" style="display:none"></div>
<form action="teacher/editTeacher.sgt" validator="teacher/validateTeacher.sgt" onsubmit="submitFormValidation(this); return false;" onreset="$('error').hide()">
	<input type="hidden" name="id" value="${(teacher.id)!}"/>
	
	<table id="dataTable" align="center" cellspacing="5" cellpadding="0">
		<tr>
			<td class="name"><@required/>${i18n.getMessage('firstName')}:</td>
			<td><input type="text" name="firstName" value="${(teacher.firstName)!}" style="width:200px"/> </td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('midName')}:</td>
			<td><input type="text" name="midName" value="${(teacher.midName)!}" style="width:200px"/> </td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('lastName')}:</td>
			<td><input type="text" name="lastName" value="${(teacher.lastName)!}" style="width:200px"/> </td>
		</tr>
		<tr>
			<td class="name">${i18n.getMessage('dateOfBirth')}:</td>
			<td><input type="text" name="dateOfBirth" value="${(teacher.dateOfBirth)!}" style="width:200px"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].dateOfBirth, '${i18n.getMessage('format.date')}', this)"/></td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('gender')}:</td>
			<td>
				<input type="radio" name="gender" value="MALE" <#if 'MALE' = (teacher.gender)!>checked</#if>/> ${i18n.getMessage('gender.male')}
				<input type="radio" name="gender" value="FEMALE" <#if 'FEMALE' = (teacher.gender)!>checked</#if>/> ${i18n.getMessage('gender.female')}
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('teacherType')}:</td>
			<td>
				<select name="teacherType" style="width:204px">
					<#list teacherTypes as teacherType>
						<option value="${teacherType}" <#if (teacherType = (teacher.teacherType)!)>selected</#if>>${i18n.getMessage(teacherType.key)}</option>
					</#list>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('nationality')}:</td>
			<td>
				<select name="nationality" style="width:204px">
					<#list nationalities as nationality>
						<option value="${nationality}" <#if (nationality = (teacher.nationality)!)>selected</#if>>${i18n.getMessage(nationality.key)}</option>
					</#list>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('campus')}:</td>
			<td>
				<select name="campus" style="width:204px">
					<#list campuses as campus>
						<option value="${campus}" <#if (campus.toString() = 'QUANGTRUNG')>selected</#if>>${i18n.getMessage(campus.key)}</option>
					</#list>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name"> ${i18n.getMessage('email')}:</td>
			<td><input type="text" name="email" value="${(teacher.email)!}" style="width:200px"/> </td>
		</tr>
		<tr>
			<td class="name"> ${i18n.getMessage('phoneNumber')}:</td>
			<td><input type="text" name="phoneNumber" value="${(teacher.phoneNumber)!}" style="width:200px"/> </td>
		</tr>
		<tr>
			<td class="name"> ${i18n.getMessage('options')}:</td>
			<td><input type="checkbox" name="active" value="true" <#if teacher.active>checked</#if>/> ${i18n.getMessage('active')}</td>
		</tr>
		<tr>
			<td class="name" style="vertical-align:top">${i18n.getMessage('comment')}:</td>
			<td><textarea name="comment" style="width:350px;height:80px;">${(teacher.comment)!}</textarea></td>
		</tr>
		<tr>
			<td></td>
			<td>
				<input type="submit" value="${i18n.getMessage('edit')}" class="button_style"/> 
				<input type="reset" value="${i18n.getMessage('reset')}" class="button_style"/> 
			</td>
		</tr>
	</table>
</form>

<script>
	$('error').hide();
</script>